<!DOCTYPE html>
<html lang="en">
<head>
    <title>大区陪跑报表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_855021_i2jfy4r0uq.css">
    <script src="https://file.ggxqce.com/web/vue.min.js"></script>
    <style>
        body, html {
            width: 100%;
            margin: 0;
            font-family: "微软雅黑";
        }

        #allmap, #allmap2 {
            /*width: 100%;*/
            height: 300px;
            overflow: hidden;
            margin: 0;
            font-family: "微软雅黑";
        }

        [v-cloak] {
            display: none;
        }

        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            font-size: 12px;
        }

        body {
            margin: 1px;
            background: #ffffff;
        }

        .boxBoy {
            background: #fff;
        }

        table {
            border-spacing: 0;
            border-collapse: collapse;
            display: table;
        }

        .weather {
            text-align: center;
            font-size: 16px;
            /*position: absolute;*/
            top: 5px;
            line-height: 30px;
            float: left;
        }

        th {
            font-weight: normal;
        }

        table.text-center, table.text-center td, table.text-center th {
            text-align: center;
            font-size: 12px;
            margin-top: -1px;
        }

        .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
            border: 1px solid #cbcbcd;
            height: 28px;
            position: relative;
            color: #333;
            padding: 0 4px;
        }

        table th {
            background: #f8f8f8;
        }

        .table-bordered {
            border: 1px solid #cbcbcd;
        }

        .table {
            width: 100%;
            max-width: 100%;
        }

        .hidden {
            display: none;
        }

        .lineOne, .lineTwo {
            text-align: left;
        }

        .tdColor {
            background-color: #f8f8f8;
            font-weight: normal;
        }

        .lineOne span {
            max-height: 24px;
            line-height: 24px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .lineTwo span {
            max-height: 55px;
            line-height: 16px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
            text-align: left;
            padding: 5px;

        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .clear {
            clear: both
        }

        .boxItem {
            width: 100%;
            margin-top: 5px;
            background: inherit;
            /*background-color: rgba(255, 255, 255, 1);*/
            border: none;
            position: relative;
        }

        .boxItemTitle {
            color: #000;
            font-size: 22px;
            font-weight: bold;
            margin-bottom: 6px;
            text-align: center;
        }

        .home {
            font-size: 14px;
            font-weight: bold;
            margin-bottom: 10px;
            height: 14px;
            line-height: 14px;
            text-align: center;
        }

        .dian-icon {
            background: url("/dist/img/dian.png") no-repeat;
            background-size: cover;
            width: 14px;
            height: 14px;
            display: inline-block;
        }

        .jiaobiao, .jiaobiaoNew {
            position: relative;
        }

        .jiaobiao i {
            display: block;
            width: 0;
            height: 0;
            border-width: 0px 0 12px 12px;
            border-style: solid;
            border-color: transparent transparent transparent #2a8cec;
            position: absolute;
            top: 0px;
            left: 0px;
        }

        .jiaobiaoNew i {
            display: block;
            width: 12px;
            height: 12px;
            background: url("/dist/img/newLog2.png");
            background-size: 100% 100%;
            position: absolute;
            top: 0px;
            left: 0px;
        }

        .lineImg {
            padding-top: 5px !important;
            padding-bottom: 10px !important;
        }

        .lineImg img {
            height: 45px;
            width: 45px;
            float: left;
            margin: 10px;
            object-fit: cover;
        }

        .newCustomer {
            background: url(/dist/img/new.png) no-repeat;
            background-size: cover;
            width: 20px;
            height: 20px;
            right: 0;
            top: 2px;
            position: absolute;
        }

        .wajueji {
            padding-left: 140px;
            background: url("/dist/img/wajueji.png") no-repeat;
            background-size: 120px 88px;
            height: 88px;
            line-height: 88px;
            color: red;
            font-size: 14px;
            font-weight: bold;
            margin-left: 50px;
        }

        .qipao {
            /*background: url(/dist/img/qipao.png);*/
            background-size: 100% 100%;
            height: 88px;
            /* padding: 0 20px; */
            padding-left: 20px;
            /*padding-right: 20px;*/
            color: red;
            line-height: 88px;
            float: left;
            font-size: 14px;
            font-weight: bold;
        }

        .plan1 {
            background: url("/dist/img/plan1.png") no-repeat center center;
            background-size: 100%;
        }

        .plan2 {
            background: url("/dist/img/plan2.png") no-repeat center center;
            background-size: 100%;
        }

        .plan3 {
            background: url("/dist/img/plan3.png") no-repeat center center;
            background-size: 100%;
        }

        .boxItemTitleNotice {
            color: red;
            font-size: 22px;
            font-weight: bold;
            margin-bottom: 10px;
            text-align: center;
        }

        .boxItemTitleNotice i {
            background: url("/dist/img/jg.png") no-repeat center center;
            height: 22px;
            width: 22px;
            background-size: cover;
            display: inline-block;
            margin-bottom: -3px;
            margin-left: 5px;
        }

        .boxItemTitleNoticeTime {
            color: red;
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 10px;
            text-align: center;
        }

        .boxItemTitleNoticeTime i {
            background: url("/dist/img/jg.png") no-repeat center center;
            height: 16px;
            width: 16px;
            background-size: cover;
            display: inline-block;
            margin-bottom: -3px;
            margin-left: 5px;
        }

        .search-button {
            width: 14px;
            height: 14px;
            background-image: url(/dist/img/glass.jpg);
            border: 0 none;
            cursor: pointer;
            margin-top: 0px;
        }

        input[type=button] {
            outline: none;
        }

        .oaBtn {
            background: url(/dist/img/btn-bj2.png) repeat-y !important;
            background-size: 100% 100% !important;
            color: #fff !important;
        }

        .btn-group-sm > .btn, .btn-sm {
            padding: 2px 10px;
        }

        .btn {
            border-radius: 3px;
            -webkit-box-shadow: none;
            box-shadow: none;
            border: 1px solid transparent;
        }

        .pull-right {
            float: right !important;
        }

        .blue {
            color: #39c;
        }

        .red {
            color: #e03800;
        }

        .weather img {
            height: 30px;
            width: 30px;
            float: left;
        }

        .templateStyle {
            margin-top: 15px;
            margin-left: 10px;
            margin-right: 10px;
        }
        .icon-zhankai, .icon-shouqi {
            cursor: pointer;
            border-radius: 5px;
            float: right;
            font-weight: bold;
        }

    </style>
</head>
<body>
<section id="app" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <div class="templateStyle">
        <div class="boxItem">
            <div class="boxBoy">
                <table class="table table-bordered text-center table-width">
                    <tr>
                        <td colspan="4" style="background: #2a8cec;color: #fff;">
                            <span style="margin-left: 16px;">陪跑报表</span>
                            <span class="iconfont icon-zhankai" v-if="btn2==0"
                                  @click="btn2=1"></span>
                            <span class="iconfont icon-shouqi" v-if="btn2==1"
                                  @click="btn2=0"></span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor" style="width:25%;">拜访日期</td>
                        <td class="tdColor" style="width:25%;">陪跑人</td>
                        <td class="tdColor" style="width:25%;">客户</td>
                        <td class="tdColor" style="width:25%;">面访时长</td>
                    </tr>
                    <template v-if="btn2==0">
                        <tr v-for="(item,i) in reportVisit.faceTargetDay" v-if="item.bigFaceTime==today">
                            <td style="border-right:1px solid #cbcbcd;" :rowspan="item.bigFaceTimespan" :class="{hidden: item.bigFaceTimedis}">
                                {{(item.bigFaceTime).substr(5,10)?convertDate(item.bigFaceTime):"-"}}
                            </td>
                            <td>{{item.entourage}}</td>
                            <td style="color:#169BD5;cursor: pointer" @click="lookInterview(item,i)"
                                v-if="item.customerName">{{item.customerName}}
                            </td>
                            <td v-else>-</td>
                            <td v-if="item.timeDiff!=0">{{item.timeDiff}}分</td>
                            <td v-else>
                                {{item.bigArrivalsTime?item.bigArrivalsTime:"-"}}/{{item.leaveTime?item.leaveTime:"-"}}
                            </td>
                        </tr>
                    </template>
                    <template v-else>
                        <tr v-for="(item,i) in reportVisit.faceTargetDay">
                            <td style="border-right:1px solid #cbcbcd;" :rowspan="item.bigFaceTimespan" :class="{hidden: item.bigFaceTimedis}">
                                {{(item.bigFaceTime).substr(5,10)?convertDate(item.bigFaceTime):"-"}}
                            </td>
                            <td>{{item.entourage}}</td>
                            <td style="color:#169BD5;cursor: pointer" @click="lookInterview(item,i)"
                                v-if="item.customerName">{{item.customerName}}
                            </td>
                            <td v-else>-</td>
                            <td v-if="item.timeDiff!=0">{{item.timeDiff}}分</td>
                            <td v-else>
                                {{item.bigArrivalsTime?item.bigArrivalsTime:"-"}}/{{item.leaveTime?item.leaveTime:"-"}}
                            </td>
                        </tr>
                    </template>
                </table>
                <table v-if="btn2==0" class="table table-bordered text-center table-width" style="margin-top: -1px">
                    <!--收起状态-->
                    <tbody>
                    <tr>
                        <td style="width: 75%;">陪跑总数量</td>
                        <td style="width: 25%;">
                            {{reportVisit.faceTargetInfo.complete?reportVisit.faceTargetInfo.complete:"0"}}
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="clear"></div>
        </div>
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="/dist/plugins/scroll/myScroll.js"></script>
<!--框架已定义 JS-->
<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js"></script>

<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script>
    $.ajaxSetup({
        global: true,
        type: "POST",
        cache: false,
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        beforeSend: function () {
        },
        complete: function () {

        },
        error: function (e) {
            alert('error' + e.responseText);
        }
    });
    $.extend($.wyui, {
        postMethod: function (url, data, callback, sync, id) {
            if (!id) {
                id = "#app"
            }
            $.ajax({
                url: server.ip + url,
                async: sync ? false : true,
                data: JSON.stringify(data),
                beforeSend: function () {

                },
                complete: function () {
                    setTimeout(function () {
                    }, 1000);

                },
                success: function (r) {
                    if (!r.e.code) {
                        callback(r.data.sendData);
                    } else {
                        alert(r.e.desc);
                    }
                },
                error: function (e) {
                    alert(url + e.responseText);
                }
            });
        },
    });
</script>
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            reportVisit: {
                "faceTargetInfo": {"target": "", "complete": ""},
                "telTargeInfo": {"target": "", "complete": ""},
            },
            userId: getUrlParamObj().userId,
            name: getUrlParamObj().name,
            dateTime: getUrlParamObj().dateTime,
            yesterday: new Date(new Date() - 24 * 60 * 60 * 1000).Format("yyyy-MM-dd"),
            today: new Date().Format("yyyy-MM-dd"),
            hour: new Date().getHours(),
            type: getUrlParamObj().visitType,
            colorDate: [],
            btn2: 0,
        },
        methods: {
            isFair: function (item) {
                var str = '';
                if (!this.distanceJq(item.signInDistance) && !this.timeJq(item.signInTimeDiff)) {
                    str = "距离、时间不合理"
                }
                else if (!this.distanceJq(item.signInDistance)) {
                    str = "距离不合理"
                }
                else if (!this.timeJq(item.signInTimeDiff)) {
                    str = "时间不合理"
                }
                return str
            },
            //距离合理->true 不合理->false
            distanceJq: function (d) {
                if (d) {
                    var str = d.replace("公里", "");
                    return Number(str) < 15
                }
            },
            //时间合理->true 不合理->false
            timeJq: function (t) {
                if (t) {
                    if (t.indexOf("小时") > 0) {
                        var hour = t.split("小时")[0];
                        if (Number(hour) > 0) {
                            return false;
                        }
                    } else {
                        if (t.indexOf("分") > 0) {
                            var min = t.split("分")[0];
                            if (Number(min) > 30) {
                                return false;
                            }
                        } else {
                            return true;
                        }
                    }
                }
                return true;
            },
            //时间间隔
            dJq: function (d) {
                if (d) {
                    var str = d.replace("公里", "");
                    if (str == '0') {
                        return '';
                    } else {
                        return Number(str).toFixed(2);
                    }
                }
            },
            //距离间隔
            disJq: function (dis) {
                if (dis) {
                    var str = dis.replace("km/h", "");
                    return str;
                }
            },
            //去秒加0几分
            quMiao: function (m) {
                if (!m) return ""
                //1小时11分11秒
                var hour = "0"
                var min = "0"
                var sec = "0"

                if (m.indexOf("小时") > 0) {
                    //{1  , 11分11秒}
                    hour = m.split("小时")[0]
                }
                if (m.indexOf("分") > 0) {
                    //{1小时11，11秒}
                    min = m.split("分")[0]
                    if (min.indexOf("小时") > 0) {
                        //{1,11}
                        min = min.split("小时")[1]
                    }
                    if (Number(min) < 10) {
                        min = "0" + min
                    }
                }
                if (min == "0" && m.indexOf("秒") > 0) {
                    //21秒
                    return hour + "小时01分"
                }
                return hour + "小时" + min + "分"
            },
            //添加0小时xx分
            addZeroHour: function (h) {
                if (!h) {
                    return ""
                }
                if (h.indexOf('小时') > 0) {
                    return h
                } else {
                    return "0小时" + h
                }
            },
            //合并单元格
            tablesMergeCell: function (list) {
                if (list != undefined && list && list.length > 0) {
                    for (field in list[0]) {
                        var k = 0;
                        while (k < list.length) {
                            list[k][field + 'span'] = 1;
                            list[k][field + 'dis'] = false;
                            for (var i = k + 1; i <= list.length - 1; i++) {
                                if (list[k][field] == list[i][field] && list[k][field] != '') {
                                    list[k][field + 'span']++;
                                    list[k][field + 'dis'] = false;
                                    list[i][field + 'span'] = 1;
                                    list[i][field + 'dis'] = true;
                                } else {
                                    break;
                                }
                            }
                            k = i;
                        }
                    }
                }
                return list;
            },
            convertDate: function (str) {
                var oldTime = (new Date(str + " 20:11:11")).getTime();
                var curTime = new Date(oldTime).Format("M月d日");
                return curTime;
            },

            lookInterview: function (item, i) {
                var that = this;
                var obj = {
                    type: 'lookInterviewDetail',
                    url: '',
                    id: item.id,
                    name: '',
                    dateTime: ''
                }
                prompt(JSON.stringify(obj))
            },
            delEmpty: function (str) {
                if (str && str.indexOf("公里") < 0) {
                    return ""
                } else return str
            },
            colorBS: function (date) {
                var that = this;
                console.log($.inArray(date, that.colorDate) != -1);
                if ($.inArray(date, that.colorDate) != -1) {
                    return true;
                } else {
                    return false;
                }

            },
        },

        mounted: function () {
            var that = this;
            var dialog = {
                dialog: 'show'
            }
            prompt(JSON.stringify(dialog))
            $.wyui.postMethod(urlConfig.report.visitCustomer.getBigRegionManagerFaceList, {
                "userId": that.userId,
                "dateTime": that.dateTime,
                "today": that.today,
                "visitType": that.type
            }, function (data) {
                console.log(data.sendData)
                that.reportVisit = data;
                that.reportVisit.faceTargetDay = that.tablesMergeCell(that.reportVisit.faceTargetDay)
                var dialog = {
                    dialog: 'hidden'
                }
                prompt(JSON.stringify(dialog))
            });

//            var param = {
//                "userId": that.userId,
//                "dateTime": that.dateTime,
//                "today": that.today,
//                "visitType": that.type
//            }
//            $.ajax({
//                url: server.ip + urlConfig.report.visitCustomer.getBigRegionManagerFaceList,
//                contentType: 'application/json;charset=utf-8',
//                type: "POST",
//                data: JSON.stringify(param),
//                success: function (r) {
//                    var dialog = {
//                        dialog: 'hidden'
//                    }
//                    prompt(JSON.stringify(dialog))
//
//                    var res = JSON.parse(r);
//                    var sendData = res.data.sendData
//                    that.reportVisit = sendData;
//                    that.reportVisit.faceTargetDay = that.tablesMergeCell(that.reportVisit.faceTargetDay)
//                    that.reportVisit.telTargetDay = that.tablesMergeCell(that.reportVisit.telTargetDay)
//                },
//                error: function (e) {
//                    var dialog = {
//                        dialog: 'hidden'
//                    }
//                    prompt(JSON.stringify(dialog))
//                    alert(e.responseText)
//                }
//            })
        }

    });
</script>
</body>
</html>